package interfaz_movimiento;

import interfaces.impl.HumanInteraction;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;

import javax.swing.JMenu;
import javax.swing.JMenuItem;
import javax.swing.JPopupMenu;


import objects.WorldObject;

public class PopUpInteraction extends JPopupMenu{
	
	private HumanInteraction humanInteraction=null;
	private int numParameters =0;
	
	public PopUpInteraction(WorldObject object, final PaintPanel paintPanel){
		super();
		JMenuItem menu;
		
		humanInteraction=null;
		
		
		for(final HumanInteraction human : object.getListHumanInteractions()){
			menu=new JMenuItem(human.getName());
			add(menu);
			menu.addActionListener(new ActionListener() {
				
				@Override
				public void actionPerformed(ActionEvent e) {
					humanInteraction = human;
					numParameters=human.getTotalParameters();
					if(human.getTotalParameters()==0){
						System.out.println("esta nulo");
						
					}
					paintPanel.setStatus(Constants.PARAMETERS_FOR_ACTION);
				}
			}); 
		}
		/*menu=new JMenuItem("Esto");
		add(menu);*/
	}

			
	public PopUpInteraction() {
		
	}


	public HumanInteraction getHumanInteraction() {
		return humanInteraction;
	}

	public void setHumanInteraction(HumanInteraction humanInteraction) {
		this.humanInteraction = humanInteraction;
	}


	public int getNumParameters() {
		return numParameters;
	}


	public void setNumParameters(int numParameters) {
		this.numParameters = numParameters;
	}

	
}
